21 research outputs found

    Supporting Separate Compilation in a Defunctionalizing Compiler

    Get PDF
    Defunctionalization is generally considered a whole-program transformation and thus incompatible with separate compilation. In this paper, we formalize a modular variant of defunctionalization which can support separate compilation. Our technique allows modules in a Haskell-like language to be separately defunctionalized and compiled, then linked together to generate an executable program. We provide a prototype implementation of our modular defunctionalization technique and we discuss the experiences of its application in a compiler from a large subset of Haskell to low-level C code, based on the intensional transformation

    Denotational semantics of ANSI C

    No full text
    The semantics of C is described in the ANSIrISO standard using natural language. This paper contains a brief summary, more descriptive than technical, of our research in specifying a complete and accurate formal semantics for ANSI C. We follow the denotational approach and divide the specification in three distinct phases: static, typing and dynamic semantics. Moreover, we have developed a direct implementation of the semantics, using the programming language Haskell. We argue that our formal specification results in a better understanding of the semantics of ANSI C and comment on its readability

    A Resumption Monad Transformer and its Applications in the Semantics of Concurrency

    No full text
    Resumptions are a valuable tool in the analysis and design of semantic models for concurrent programming languages, in which computations consist of sequences of atomic steps that may be interleaved. In this paper we consider a general notion of resumption, parameterized by the kind of computations that take place in the atomic steps. We define a monad transformer which, given a monad M that represents the atomic computations, constructs a monad R(M) for interleaved computations. Moreover, we use this monad transformer to define the denotational semantics of a simple imperative language supporting nondeterminism and concurrency

    Denotational Semantics of Evaluation Order in Expressions with Side Effects

    No full text
    The presence of side effects in even a very simple language of expressions gives rise to a number of semantic questions. The issue of evaluation order becomes a crucial one and, unless a strict order is enforced, the language becomes non-deterministic. In this paper we study the semantics of such a language under a variety of possible evaluation strategies, from simpler to more complex, concluding with unspecified evaluation order, unspecified order of side effects and the mechanism of sequence points that is particular to the ANSI C programming language. In doing so, we adopt the denotational semantics approach and use monads to improve modularity and to reduce the number of changes required for each transition. The result is a better understanding of different evaluation strategies, possibly leading to non-determinism in the presence of side effects, and a unified way of specifying their semantics. Furthermore, a significant step is achieved towards a correct denotational semantics f..

    A Formal Semantics for the C Programming Language

    No full text
    educational and research purposes, provided that the source is acknowledged and the presen

    A Study of Evaluation Order Semantics in Expressions with Side Effects

    No full text
    The presence of side effects in even a very simple language of expressions gives rise to a number of semantic questions. The issue of evaluation order becomes a crucial one and, unless a specific order is enforced, the language becomes non-deterministic. In this paper we study the denotational semantics of such a language under a variety of possible evaluation strategies, from simpler to more complex, concluding with unspecified evaluation order, unspecified order of side effects and the mechanism of sequence points that is particular to the ANSI C programming language. In doing so, we adopt a dialect of Haskell as a metalanguage, instead of mathematical notation, and use monads and monad transformers to improve modularity. In this way, only small modifications are required for each transition. The result is a better understanding of different evaluation strategies and a unified way of specifying their semantics. Furthermore, a significant step is achieved towards a complete and accurate semant..

    Continuations for Parallel Logic Programming

    No full text
    This paper gives denotational models for three logic programming languages of progressive complexity, adopting the \logic programming without logic" approach. The rst language is the control ow kernel of sequential Prolog, featuring sequential composition and backtracking. A committedchoice concurrent logic language with parallel composition (parallel AND) and don't care nondeterminism is studied next. The third language is the core of Warren's basic Andorra model, combining parallel composition and don't care nondeterminism with two forms of don't know nondeterminism (interpreted as sequential and parallel OR) and favoring deterministic over nondeterministic computation. We show that continuations are a valuable tool in the analysis and design of semantic models for both sequential and parallel logic programming. Instead of using mathematical notation, we use the functional programming language Haskell as a metalanguage for our denotational semantics, and employ monads in order to facilitate the transition from one language under study to another. Keywords Parallel logic programming, basic Andorra model, denotational semantics, continuations, monads, Haskell. 1
    corecore